
import Vue from 'vue'
import axios from 'axios'
import { Toast } from 'vant'
import http from "./config.js"
import Qs from 'qs'
import store from "@/store"
import router from '@/router'  //引入router


const api="http://cronusart.vip/kk/";
const index=api+"index";//首页
const goodstp=api+"goodstp";//分类
const gddetail=api+'gddetail/';//商品详情
const goodslt=api+"goodslt";//商品列表分类
const register=api+"reg";//注册
const login=api+"login";//登录
const scartadd=api+'scartadd';//加入购物车
const goodcol=api+'goodcol';//收藏
const goodlike = api+'get_like';
const cartlist=api+"cartlist";//购物车页面
const cart_selected=api+"cart_selected";//商品选中不选中
const cart_num_set=api+"cart_num_set";//商品数量修改
const cart_del=api+"cart_del";//商品删除
const cart_settlement=api+'cart_settlement';//购物车结算
const adssindex=api+'adssindex';//我的地址
const pay=api+'pay';//支付
const perindex=api+"perindex";//个人中心首页
const adsedit=api+"adsedit";//新增地址
const adsgetone=api+"adsgetone";//获取一条地址信息
const adsdel=api+"adsdel";//删除地址
const adsdefault=api+'adsdefault';//设为默认地址
const odi=api+"odi";//我的订单
const oddet=api+"oddet";//订单详情
const odcod=api+"odcod";//取消订单
const odsuod=api+"odsuod";//订单确认收货
const fsts=api+"fsts";//订单查询物流
const odcomt=api+"odcomt";//订单评价
const goodcolhist=api+"goodcolhist";//商品收藏列表
const uploader=api+"uploader";//商品收藏列表
const send = api + 'send';
const get_goods_poster = api +"get_goods_poster";
const askImg = api + 'get_specsimg'







//获取类表
let getData={}





//首页
getData.index=(data)=>{
  return http.post(index,data)
}
//分类
getData.classType=(data)=>{
  return http.post(goodstp,data)
}
//分类列表
getData.classList=(data)=>{
  //data = Qs.stringify(data)
  return http.post(goodslt,data)
}
//获取分类详情
getData.goodsDes=(data)=>{
  //data = Qs.stringify(data)
  return http.post(gddetail,data)
};
//加入购物车
getData.scarTadd=(data)=>{
  //data = Qs.stringify(data)
  return http.post(scartadd,data)
};
//收藏goodcol
getData.goodCol=(data)=>{
  //data = Qs.stringify(data)
  return http.post(goodcol,data)
};
//点赞
getData.goodLike=(data)=>{
  return http.post(goodlike,data)
}
//购物车
getData.cartList=(data)=>{

    return http.post(cartlist,data)
  
 
};
//修改数量cart_num_set
getData.cartNum_set=(data)=>{
  return http.post(cart_num_set,data)
};
//购物车删除
getData.cartDel=(data)=>{
  return http.post(cart_del,data)
}
//支付
getData.pay=(data)=>{
  return http.post(pay,data)
}


//购物车商品选中cart_selected
getData.cartSelected=(data)=>{
  return http.post(cart_selected,data)
}
//购物车结算
getData.cartSettlement=(data)=>{
  return http.post(cart_settlement,data)
}
//我的地址
getData.adSsindex=(data)=>{
  return http.post(adssindex,data)
}



//获取注册
getData.reg=(data)=>{
  
  // data = Qs.stringify(data)
  // console.log('data'+data)
  return http.post(register,data)
};
//获取短信验证码
getData.send=(data)=>{
  return http.post(register,data)
};
//获取登录
getData.login=(data)=>{
  console.log(data);
  //data = Qs.stringify(data)
  return http.post(login,data)
};


//个人中心首页
getData.perIndex=(data)=>{
  return http.post(perindex,data)
};
getData.get_goods_poster=(data)=>{
  return http.post(get_goods_poster,data)
};

//新增地址
getData.adseDit=(data)=>{
  return http.post(adsedit,data)
};
//获取一条地址信息
getData.adsGetone=(data)=>{
return http.post(adsgetone,data)
};
//删除地址
getData.adsDel=(data)=>{
  return http.post(adsdel,data)
};
//设置默认地址
getData.adsDefault=(data)=>{
  return http.post(adsdefault,data)
};
//我的订单
getData.Odi=(data)=>{
  return http.post(odi,data)
};
//订单详情
getData.odDet=(data)=>{
  return http.post(oddet,data)
};
//取消订单
getData.odCod=(data)=>{
  return http.post(odcod,data)
};
//订单确认收货
getData.odSuod=(data)=>{
  return http.post(odsuod,data)
};
//订单查询物流
getData.fsTs=(data)=>{
  return http.post(fsts,data)
};
//订单评价
getData.odComt=(data)=>{
  return http.post(odComt,data)
};
//商品收藏列表
getData.goodColhist=(data)=>{
  return http.post(goodcolhist,data)
};
//图片上传
getData.uploader=(data)=>{
  return http.post(uploader,data)
};

//获取规格图片
getData.askImg = (data)=>{
  return http.post(askImg,data)
}

export default getData


